#include <iostream>
#include <vector>
template <typename T> void select_sort(std::vector<T> &v) {
  // 选择排序 ： 每次从未排序数据中选择最小的元素 放到未排序区域的前面
  int i = 0, j = v.size();
  while (i != j - 1) {
    int min_index = i;
    for (int k = i + 1; k < j; k++) {
      if (v[k] < v[min_index]) {
        min_index = k;
      }
    }
    T t = v[i];
    v[i] = v[min_index];
    v[min_index] = t;
    i++;
  }
}

int main() {
  std::vector<int> list = {2, 4, 3, 6, 7, 3, 4, 2};
  select_sort<int>(list);
  for (int &i : list) {
    std::cout << i;
  }

  return 0;
}